/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AgregarProveedor.java
 *
 * Created on 11/01/2009, 12:31:50 PM
 */

package UIDelNegocio;

import LogicaDeNegocio.Main;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;

/**
 *
 * @author Anya
 */
public class AgregarProveedor extends javax.swing.JFrame {
public static String name;
public static String tipo;
public static int opc;
    /** Creates new form AgregarProveedor */

    public AgregarProveedor(String name1, String tipo1, int opc1) {
        name= name1;
        tipo= tipo1;
        opc= 1;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextField18 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextField19 = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextField20 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextField21 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jTextField22 = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextField23 = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTextField24 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTextField25 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("WellDressing");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        jLabel1.setText("Agregar Proveedor");

        jLabel2.setText("RIF:");

        jTextField18.setFont(new java.awt.Font("Tahoma", 0, 10));
        jTextField18.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField18.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jTextField18.setPreferredSize(new java.awt.Dimension(22, 27));

        jLabel3.setText("Nombre:");

        jTextField19.setFont(new java.awt.Font("Tahoma", 0, 10));
        jTextField19.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField19.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jTextField19.setPreferredSize(new java.awt.Dimension(22, 27));

        jLabel4.setText("Telefono:");

        jTextField20.setFont(new java.awt.Font("Tahoma", 0, 10));
        jTextField20.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField20.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jTextField20.setPreferredSize(new java.awt.Dimension(22, 27));

        jLabel5.setText("Direccion:");

        jTextField21.setFont(new java.awt.Font("Tahoma", 0, 10));
        jTextField21.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField21.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jTextField21.setPreferredSize(new java.awt.Dimension(22, 27));

        jLabel6.setText("Persona de Contacto:");

        jLabel7.setText("Cedula:");

        jTextField22.setFont(new java.awt.Font("Tahoma", 0, 10));
        jTextField22.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField22.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jTextField22.setPreferredSize(new java.awt.Dimension(22, 27));

        jLabel8.setText("Nombre:");

        jTextField23.setFont(new java.awt.Font("Tahoma", 0, 10));
        jTextField23.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField23.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jTextField23.setPreferredSize(new java.awt.Dimension(22, 27));

        jLabel9.setText("Apellido:");

        jTextField24.setFont(new java.awt.Font("Tahoma", 0, 10));
        jTextField24.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField24.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jTextField24.setPreferredSize(new java.awt.Dimension(22, 27));

        jLabel10.setText("Telefono:");

        jTextField25.setFont(new java.awt.Font("Tahoma", 0, 10));
        jTextField25.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextField25.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jTextField25.setPreferredSize(new java.awt.Dimension(22, 27));

        jButton1.setText("Agregar Proveedor");
        jButton1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(272, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(84, 84, 84))
            .addGroup(layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGap(132, 132, 132)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTextField23, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                                    .addComponent(jTextField25, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                                    .addComponent(jTextField24, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
                                    .addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(80, 80, 80))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel5))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField20, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel7)
                                    .addComponent(jLabel8)
                                    .addComponent(jLabel9)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(1, 1, 1)
                                        .addComponent(jLabel10)))
                                .addComponent(jLabel6)))
                        .addGap(84, 84, 84))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(jLabel1)
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jTextField19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jTextField20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addComponent(jLabel6)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addGap(38, 38, 38)
                .addComponent(jButton1)
                .addContainerGap(13, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

        Main control = new Main();

        

       
int b = control.guardarPersona(Integer.parseInt(jTextField22.getText()), jTextField23.getText(), jTextField24.getText(), jTextField25.getText());
       int a = control.guardarProveedor(jTextField18.getText(), jTextField19.getText(), jTextField20.getText(), jTextField21.getText(), "Distributodo",Integer.parseInt(jTextField22.getText()));
        //int b = control.guardar(Integer.parseInt(jTextField22.getText()), jTextField23.getText(), jTextField24.getText(), jTextField25.getText());

       // int a = control.guardarEmpleado(Integer.parseInt(jTextField13.getText()), jTextField11.getText(), jTextField12.getText(), fechaNac/*jDateChooser1.getDate()*/, jTextField16.getText(),(String)jComboBox1.getSelectedItem(), (String)jComboBox2.getSelectedItem(), jTextField14.getText(), Integer.parseInt(jTextField15.getText()), (String)jComboBox4.getSelectedItem(),fechaEnt, jTextField17.getText(), "Tertulia", null);

       

        AgregarProductosDeProveedor vent= new AgregarProductosDeProveedor(jTextField18.getText());
        this.setVisible(false);
        vent.setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
       
    }//GEN-LAST:event_formWindowActivated

    /**
    * @param args the command line arguments
  
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AgregarProveedor().setVisible(true);
            }
        });
    }  */

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jTextField18;
    private javax.swing.JTextField jTextField19;
    private javax.swing.JTextField jTextField20;
    private javax.swing.JTextField jTextField21;
    private javax.swing.JTextField jTextField22;
    private javax.swing.JTextField jTextField23;
    private javax.swing.JTextField jTextField24;
    private javax.swing.JTextField jTextField25;
    // End of variables declaration//GEN-END:variables

}
